<?php
class SurveyController extends ApiController{
	public function save(){
		$data['r_01'] = request('s_1');
		$data['r_02'] = request('s_2');
		$data['r_03'] = request('s_3');
		$data['r_04'] = request('s_4');
		$data['r_05'] = request('s_5');
		$data['r_06'] = request('s_6');
		$data['r_07'] = request('s_7');
		$data['r_08'] = request('s_8');
		$data['department_id'] = request('department_id');
		$data['ip'] = get_client_ip();
		$data['pubtime'] = time();
		
		foreach ($data as $item){
			if (!$item){
				$this->error(202, '请把所有的选项填写完整');
			}
		}
		if (SurveylogModel::add($data)) {
			$this->success(array());
		}else{
			$this->error(202, '服务器繁忙，请稍候再试');
		}
	}
}